package com.bjdd.jdy.ui.newsDetail;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bjdd.jdy.R;
import com.bjdd.jdy.base.BaseActivity;
import com.bjdd.jdy.entity.NewsBean;
import com.bjdd.jdy.util.DateUtils;
import com.bjdd.jdy.util.StatusBarUtil;

import butterknife.Bind;
import butterknife.ButterKnife;

public class NewsDetailActivity extends BaseActivity<NewsDetailPresenter, NewsDetailModel> implements NewsDetailContract.View {


    @Bind(R.id.toolbar_back)
    ImageView toolbarBack;
    @Bind(R.id.title)
    TextView title;
    @Bind(R.id.tv_news_detail_title)
    TextView tvNewsDetailTitle;
    @Bind(R.id.tv_news_detail_date)
    TextView tvNewsDetailDate;
    @Bind(R.id.tv_news_detail_content)
    TextView tvNewsDetailContent;


    @Override
    public int getLayoutId() {
        return R.layout.activity_news_detail;
    }

    @Override
    public void initView() {
        StatusBarUtil.setColor(this, getResources().getColor(R.color.toolbar_bg), 0);
        title.setText("消息详情");
        Bundle bundle = this.getIntent().getExtras();
        //NewsBean newsBean = (NewsBean)bundle.getSerializable("data");
        String type = "通知";
        switch (bundle.getInt("type")){
            case 0:
                type = "通知";
                break;
            case 1:
                type = "自由人通知";
                break;
            case 3:
                type = "个人通知";
                break;
        }
        tvNewsDetailTitle.setText(type);
        tvNewsDetailDate.setText(DateUtils.formatDateTime(bundle.getLong("time")));
        tvNewsDetailContent.setText(bundle.getString("content"));
        toolbarBack.setClickable(true);
        toolbarBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

    }

}
